package sample;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Controller {
    public static void main(String[] args) throws BeansException {
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student student1 = (Student)ac.getBean("ye");
        System.out.println(student1.getName()+"导师是"+student1.getTeacher().getName());

        Student student2 = (Student)ac.getBean("peng");
        System.out.println(student2.getName()+"导师是"+student2.getTeacher().getName());
    }
}
